package com.niiwoo.civet.trade.configuration;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.niiwoo.civet.trade.constant.RabbitConstant;

/**
 * 智能投异常处理回退MQ
 * 
 * @author liuchun
 *
 *         2018年11月15日
 */
@Configuration
public class IntelligenceInvestCancelEventMqConfiguration {
	// **********************
	// 资金回退
	// **********************
	@Bean
	public Exchange investEndEventExchange() {
		return new DirectExchange(RabbitConstant.Exchange.INTELLIGENCE_INVEST_END, true, true);
	}

	@Bean
	public Queue investEndEventQueue() {
		return new Queue(RabbitConstant.Queue.INTELLIGENCE_INVEST_END, true);
	}

	@Bean
	public Binding investEndEventBinding() {
		return BindingBuilder.bind(investEndEventQueue()).to(investEndEventExchange()).with(RabbitConstant.RoutingKey.INTELLIGENCE_INVEST_END).noargs();
	}


}
